#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int panduan(vector<int>& a)
{




    sort(a.begin(), a.end(), greater<int>());

    int me = 0;
    int k = a.size();
    for (int i = 1; i <= k - (k / 3); i += 2)
    {
        me += a[i];
    }



    return me;


}
int main()
{

    int n;
    cin >> n;
    vector<int>coin(n);

    for (int i = 0; i < n; i++)
    {
        cin >> coin[i];
    }

    int me = panduan(coin);
    cout << me << endl;





    return 0;
}